package Lambda;


public class Test {
    public static void main(String[] args) {
//        Animal a = new Animal() {
//            @Override
//            public void run() {
//                System.out.println("狗跑 ");
//            }
//        };
//        a.run();
        //错误示范
//        Animal a = () -> {
//            System.out.println(" Hello");
//        };
//        a.run();

        //Lambda只能用于接口
//        Swimming s = () ->{
//            System.out.println("I'm Swimming");
//        };
            //简化
        Swimming s = () -> System.out.println("I'm Swimming");
        s.swin();
    }
}
interface Swimming{
    void swin();
}

abstract class Animal{
    public abstract void run();
}
